package main

import (
	"fmt"
	"sync"
)

func main() {
	fmt.Println("Hello")
	var wg sync.WaitGroup
	for i := 0; i < 10; i++ {
		wg.Add(1)	//启动一个协程加1
		go helloWaitGroup01(i, &wg)
	}
	wg.Wait()
	fmt.Println("World")
}
func helloWaitGroup01(i int, wg *sync.WaitGroup) {
	defer wg.Done()	//线程结束登记减1
	fmt.Println("Hello ", i)
}
